package org.zht.dormpro.dorm.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.zht.dormpro.dorm.model.TbGoodsApprove;

public interface TbGoodsApproveMapper {
    @Delete({
        "delete from tb_goods_approve",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into tb_goods_approve (id, dorm_id, ",
        "goods_name, approved_time, ",
        "approved_status, append, ",
        "status)",
        "values (#{id,jdbcType=INTEGER}, #{dormId,jdbcType=VARCHAR}, ",
        "#{goodsName,jdbcType=VARCHAR}, #{approvedTime,jdbcType=BIGINT}, ",
        "#{approvedStatus,jdbcType=TINYINT}, #{append,jdbcType=VARCHAR}, ",
        "#{status,jdbcType=TINYINT})"
    })
    int insert(TbGoodsApprove record);

    int insertSelective(TbGoodsApprove record);

    @Select({
        "select",
        "id, dorm_id, goods_name, approved_time, approved_status, append, status",
        "from tb_goods_approve",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("org.zht.dormpro.dorm.mapper.TbGoodsApproveMapper.BaseResultMap")
    TbGoodsApprove selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TbGoodsApprove record);

    @Update({
        "update tb_goods_approve",
        "set dorm_id = #{dormId,jdbcType=VARCHAR},",
          "goods_name = #{goodsName,jdbcType=VARCHAR},",
          "approved_time = #{approvedTime,jdbcType=BIGINT},",
          "approved_status = #{approvedStatus,jdbcType=TINYINT},",
          "append = #{append,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=TINYINT}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TbGoodsApprove record);
}